package com.ymttest.database.sqlwapper;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.VirtualStore;
import com.ymttest.utils.EnvSetup;

/************************************************************************************
 * @File name : VirtualStoreWapper.java
 * @Author : sunsheng
 * @Date : 2015年8月21日
 * @Copyright : 洋码头
 ************************************************************************************/
public class VirtualStoreWapper {

	SqlManager manage;

	public VirtualStoreWapper() {
		manage = new SqlManager("xlobo" + EnvSetup.getEnv());
	}

	// 返回指定userid 的scode list
	public List<String> getsCodeByUserIdAndsCode(String userId, String sCode) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("userid", userId);
		map.put("sCode", sCode);
		List<String> sCodes = new ArrayList<String>();
		List<VirtualStore> VirtualStoreList = manage.getSelectResults(
				"com.ymttest.database.mapping.VirtualStoreMapper.selectByuseridAndsCode", map);
		if (VirtualStoreList.size() > 0) {
			for (VirtualStore vs : VirtualStoreList) {
				sCodes.add(vs.getScode());
			}
		}
		return sCodes;
	}

	public static void main(String[] args) {
		Logger.debug(new VirtualStoreWapper().getsCodeByUserIdAndsCode("08115BB4-AC51-454E-90FB-AB43F3C5086B",
				"XC_Test%"));
	}

}
